#ifndef SOLOADER_FONT_CACHE_LIST_H
#define SOLOADER_FONT_CACHE_LIST_H

#include <stdint.h>

#include <SDL2/SDL.h>

typedef struct TextSurfaceListEntry
{
    struct TextSurfaceListEntry *next;
    struct TextSurfaceListEntry *previous;
    uint64_t key;
    SDL_Surface *surface;
} TextSurfaceListEntry;

typedef struct
{
    TextSurfaceListEntry *head;
    TextSurfaceListEntry *tail;
    int length;
    int max_length;
} TextSurfaceList;

TextSurfaceListEntry *TextSurfaceListGetEntryByKey(TextSurfaceList *list, uint64_t key);
TextSurfaceListEntry *TextSurfaceListGetEntryByNumber(TextSurfaceList *list, int n);

TextSurfaceListEntry *TextSurfaceListCreatEntry(uint64_t key, SDL_Surface *surface);

int TextSurfaceListRemoveEntry(TextSurfaceList *list, TextSurfaceListEntry *entry);
void TextSurfaceListAddEntryToFirst(TextSurfaceList *list, TextSurfaceListEntry *entry);
void TextSurfaceListAddEntryToLast(TextSurfaceList *list, TextSurfaceListEntry *entry);
void TextSurfaceListMoveEntryToFirst(TextSurfaceList *list, TextSurfaceListEntry *entry);
void TextSurfaceListMoveEntryToLast(TextSurfaceList *list, TextSurfaceListEntry *entry);
void TextSurfaceListEmpty(TextSurfaceList *list);

#endif